﻿package mortal.game.view.guild.hintIcon
{
    import Message.Game.*;
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class GuildInviteCreateIcon extends HintBaseIcon
    {
        private var _inviter:SMiniPlayer;

        public function GuildInviteCreateIcon()
        {
            super(ImagesConst.guild_huiIcon);
            return;
        }// end function

        private function onClose(param1:int) : void
        {
            var _loc_2:Object = {};
            _loc_2.invitePlayerId = this._inviter.entityId.id;
            _loc_2.guildId = 0;
            _loc_2.type = EInviteMode._EInviteForCreateGuild;
            if (param1 == Alert.OK)
            {
                if (Cache.instance.role.enoughMoney(EPriceUnit._EPriceUnitCoinBind, GameConst.TFreeCreateGuildCost) == false)
                {
                    MsgManager.showRollTipsMsg("" + Language.getString(71126));
                    return;
                }
                _loc_2.agree = true;
            }
            else
            {
                _loc_2.agree = false;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.GUILD_DEAL_INVITE, _loc_2));
            this.hide();
            return;
        }// end function

        public function set inviter(param1:SMiniPlayer) : void
        {
            this._inviter = param1;
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            super.clickHandler(event);
            Alert.okLabel = Language.getString(30230);
            Alert.calcelLabel = Language.getString(30231);
            Alert.show(Language.getStringByParam(30258, this._inviter.name), null, Alert.OK | Alert.CANCEL, null, this.onClose);
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show(param1, param2);
            setLabel(0);
            return;
        }// end function

    }
}
